<?php echo $this->load->view('meta'); ?>
<title>xa-ncsu | blog</title>
<?php echo $this->load->view('header'); ?>
<p><?=anchor('blog', 'back to blog');?>
<div class="entry">
	<div class="entry-title">
		<h2><?=$post->title?></h2>
		<p class="author"><?=$post->author?></p>
		<p class="posted"><?=$post->posted?></p>
	</div>
	<div class="entry-body"><?=$post->body?></div>
<?php if (isset($loggedin)) : ?>
	<?php if ($comments->num_rows() > 0) : ?>	
		<p>Responses:</p>
		<?php foreach ($comments->result() as $comment) : ?>
			<div class="comment">
				<span class="right"><?=$comment->edit?></span>
				<span><?=$comment->authorname?> - <?=$comment->posted?></span>
				<p><?=$comment->body?></p>
				<?php if($comment->edited != NULL):?><br /><p class="edited">edited by <?=$comment->editor?> on <?=$comment->edited?></p><?php endif; ?>
			</div>
		<?php endforeach; ?>
	<?php else: ?>
		<p><strong>No Responses</strong></p>
	<?php endif; ?>
	</div>
	
	<?=form_open('blog/createComment');?>
	<fieldset>
		<legend>post a comment</legend>
		<ol class="fivehundred">
			<li><label for="name">name</label>
				<input type="input" name="authorname" /></li>
			<li><label for="body">comment</label>
				<textarea name="body" rows="10"></textarea></li>
			<li><?=form_hidden('postid', $this->uri->segment(3));?>
				<?=form_submit('','submit');?></li>
		</ol>
	</fieldset>
	</form>
<?php else: ?>
	<p>You must login to view and post comments.</p>
	</div>
<?php endif; ?>
<?php echo $this->load->view('footer'); ?>